package com.education.service.impl;

import com.education.domain.Tbtest;
import com.education.domain.TbtestExample;
import com.education.mapper.TbtestMapper;
import com.education.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zhangjiawen on 2019/11/20.
 */
@Service
public class TestServiceImpl implements TestService {
    @Autowired
    private TbtestMapper tbtestMapper;


    @Override
    public List<Tbtest> getAll() {
        return tbtestMapper.selectByExample(new TbtestExample());
    }

    @Override
    public List<Tbtest> getByCondition(Tbtest tbtest) {
        TbtestExample tbtestExample=new TbtestExample();
        TbtestExample.Criteria criteria = tbtestExample.createCriteria();
        if (tbtest.getLclassid()!=null){
            criteria.andLclassidEqualTo(tbtest.getLclassid());
        }else {
            return null;
        }
        tbtestExample.setOrderByClause("nTimes");
        return tbtestMapper.selectByExample(tbtestExample);
    }
}
